package com.zhihesj.anan.system.controller;


import cn.hutool.core.bean.BeanUtil;
import com.zhihesj.anan.message.Message;
import com.zhihesj.anan.system.entity.Post;
import com.zhihesj.anan.system.service.PostService;
import com.zhihesj.anan.system.vo.PostVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 岗位信息表 前端控制器
 * </p>
 *
 * @author anan
 * @since 2020-07-31
 */
@RestController
@RequestMapping("/system/post")
public class PostController {
    @Autowired
    private PostService postService;

    @GetMapping("/getPostList")
    public Message getPostList(PostVo postVo){
        Map<String, Object> stringObjectMap = BeanUtil.beanToMap(postVo, false, true);
        if (stringObjectMap.isEmpty()) {
            List<Post> posts = postService.list();
            return Message.success(posts);
        } else {
            List<Post> posts = postService.list();
            return Message.success(posts);
        }
    }
}
